<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Article;
use Illuminate\Http\Request;
use App\Models\Index;

class PageController extends Controller
{
    
    public function index(Request $request)
    {
        $this->__cate_init__($request);
        $category = $this->category;
        //判断栏目跳转
        $redirect = $this->isLastRedirect();
        if($redirect)return $redirect;
        
        return view('page.index', compact('category'));
    }
    
    public function detail(Request $request)
    {
        $Agent = new Agent();
        $info = Article::findOrFail($request->id);
        if($Agent->isMobile())
        {
            return view('index.mobile.detail', compact('info'));
        }
        return view('index.detail', compact('info'));
    }
}


